package com.lry.crawlers.cartoon.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lry.crawlers.cartoon.entity.CartoonUpdate;
import com.lry.crawlers.cartoon.mapper.CartoonUpdateMapper;
import com.lry.crawlers.cartoon.service.CartoonUpdateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CartoonUpdateServiceImpl implements CartoonUpdateService {
    @Autowired
    CartoonUpdateMapper cartoonUpdateMapper;

    @Override
    public int setCartoonUpdate(CartoonUpdate cartoonUpdate) {
        return cartoonUpdateMapper.insert(cartoonUpdate);
    }

    @Override
    public List<CartoonUpdate> getCartoonUpdates() {
        return cartoonUpdateMapper.selectList(null);
    }

    @Override
    public int setCartoonUpdateUp(CartoonUpdate cartoonUpdate) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("cartoon_id", cartoonUpdate.getCartoonId());
        return cartoonUpdateMapper.update(cartoonUpdate,wrapper);
    }



}
